%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% COMPUTE AVOIDED EMISSIONS WHEN SET FINES AT PRE-2004 LEVELS

% "DEFORESTATION IN THE AMAZON:
% A UNIFIED FRAMEWORK FOR ESTIMATION AND POLICY ANALYSIS"

% by Eduardo Souza-Rodrigues

% This version: November 2018

% OBSERVATIONS: 
% Run this program after running "dem_def_reg.m" & "dem_def_carbon_emissions.m"

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% (A) COMPUTE TOTAL SUPPLY

% I. Load Data
% Total_emissions_for_farm_j = [co2_price' tot_co2_for_ivqr']
load Total_emissions_farm_1_fines;
load Total_emissions_farm_2_fines;
load Total_emissions_farm_3_fines;
load Total_emissions_farm_4_fines;

% II. Define Variables

% CO2 prices
%co2_price = Total_emissions_farm_1_fines(:,1);

% Total Avoided Emissions
emissions_fines = Total_emissions_farm_1_fines(:,2) + Total_emissions_farm_2_fines(:,2) + Total_emissions_farm_3_fines(:,2) + Total_emissions_farm_4_fines(:,2);


%% (B) SHOW EMISSIONS AT $1/tCO2

disp('----------------------------------------------------------------------------')
disp([char('APPENDIX: AVOIDED CARBON EMISSIONS AT U$1/tCO2 (in billion tons of carbon), FINES SET AT PRE-2004 LEVELS:'), blanks(numel(emissions_fines(11)/(10^9)))', num2str(emissions_fines(11)/(10^9))])
disp('----------------------------------------------------------------------------')
pause

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
